package cn.mf.hrm.client;

import cn.mf.hrm.doc.CourseDoc;
import cn.mf.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 降级
 */
@Component
public class CourseESFeignFallbackFactory implements FallbackFactory<CourseESFeign>{

    @Override
    public CourseESFeign create(Throwable throwable) {
        return new CourseESFeign() {
            @Override
            public AjaxResult save(CourseDoc course) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("课程发布到ES失败！");
            }
        };
    }
}
